package com.lemeshko.simple_web_app.listeners;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * Application Lifecycle Listener implementation class ContextListener
 * 
 */
public class ContextListener implements ServletContextListener {

	private Map<String, String> usersMap;
	private ServletContext context = null;

	public void contextInitialized(ServletContextEvent event) {

		context = event.getServletContext();
		usersMap = new HashMap<String, String>();
		context.setAttribute("usersMap", usersMap);
	}

	public void contextDestroyed(ServletContextEvent event) {
		context.removeAttribute("userMap");
	}
}
